/**
  ******************************************************************************
  * @file           : main.c
  * @brief          : Main program body
  * @author         : Qilong Huang <jcdiyhelp@qq.com>
  * @date           : 2021-06-08 
  * 
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2021 Joy create tech(Suzhou, China) Co., Ltd.
  * All rights reserved.
  *
  *
  ******************************************************************************
  */
/* Includes -----------------------------------------------------------------*/
#include "global.h"

/* Private function declaration ---------------------------------------------*/
static void MX_GPIO_Init(void);

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
    unsigned long y = 0;
    char *x = "Hellow";
    //HAL_Init();
    I_EEPROM_ParaInit();
    if (AppEmptyFlag == X_AREA_EMPTY)
    {
        HAL_Init();
        SystemClock_Config();
        FUNC_HardwareInit();
        FUNC_WaitProgram();
    }
    else if (AppEmptyFlag == X_AREA_FULL)
    {
        if (AppSWBiasCode < BakupSWBiasCode)
        {
            FUNC_AppMove();
        }
        else
        {
            FUNC_JampToApp();
        }
    }
    //SystemClock_Config();
    while (1)
        ;
}

/**
  * @brief GPIO Initialization Function
  * @param None
  * @retval None
  */
static void MX_GPIO_Init(void)
{

    /* GPIO Ports Clock Enable */
    __HAL_RCC_GPIOH_CLK_ENABLE();
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
}

/* USER CODE BEGIN 4 */

/* USER CODE END 4 */

/**
  * @brief  Period elapsed callback in non blocking mode
  * @note   This function is called  when TIM6 interrupt took place, inside
  * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
  * a global variable "uwTick" used as application time base.
  * @param  htim : TIM handle
  * @retval None
  */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
    /* USER CODE BEGIN Callback 0 */

    /* USER CODE END Callback 0 */
    if (htim->Instance == TIM6)
    {
        HAL_IncTick();
    }
    /* USER CODE BEGIN Callback 1 */

    /* USER CODE END Callback 1 */
}
